package com.lz.sports.bean

import android.os.Parcel
import android.os.Parcelable
import com.google.gson.annotations.Expose
import com.lz.library.proguard.IProguardField

//公共模式选择类
class CommonModel() : ParcelableString, IProguardField {

    companion object {

        const val NONE = 0

        //现场和报名照
        const val ID_CARD_EXAM = 1

        //现场和身份证照
        const val ID_CARD_ID = 2

        //身份证识别
        const val ID_CARD = 6

        //身份证,人脸,证件识别对比
        const val ID_CARD_FACE_EXAM = 7

        //身份证指纹
        const val ID_CARD_FINGER = 8

        //身份证和报名照同时匹配相机
        const val ID_CARD_AND = 12

        //身份证和电子签名
        const val ID_CARD_SIGNATURE = 15

        @JvmField
        val CREATOR = object : Parcelable.Creator<CommonModel> {
            override fun createFromParcel(parcel: Parcel): CommonModel {
                return CommonModel(parcel)
            }

            override fun newArray(size: Int): Array<CommonModel?> {
                return arrayOfNulls(size)
            }
        }
    }

    //验证模式类型
    @Expose
    var type: Int = 0

    //验证名称
    @Expose
    var name: String = ""

    constructor(parcel: Parcel) : this() {
        type = parcel.readInt()
        name = parcel.readString()!!
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeInt(type)
        parcel.writeString(name)
    }

    override fun str(): String = name

    override fun equals(other: Any?): Boolean = other === this || (other is CommonModel && other.type == type)

    override fun describeContents(): Int {
        return 0
    }

    override fun hashCode(): Int {
        var result = type
        result = 31 * result + name.hashCode()
        return result
    }


}